<template>
  <div class="box">
    <div class="listTop">
      <div class="zhezhao">
        <img :src="$root.musicStore.picUrl" />
      </div>
      <div class="ltContext">
        <img :src="$root.musicStore.picUrl" />
        <div class="text">
          <h3>
            {{ $root.musicStore.text }}
          </h3>
        </div>
      </div>
    </div>
    <Loading v-if="songs == null"></Loading>

    <ul class="song" v-if="songs != null">
      <p>歌单列表</p>
      <li class="li" v-for="(s, index) in songs" :key="s.id">
        <span>{{ (index + 1) | formatNum }}</span>
        <SongItem :item="s"></SongItem>
      </li>
    </ul>
  </div>
</template>

<script>
import Loading from "@/components/Loading";
import SongItem from "@/components/SongItem";
export default {
  data() {
    return {
      arID: null,
      songs: null,
      picurl: null,
      text: null,
    };
  },
  components: {
    SongItem,
    Loading,
  },
  created() {
    this.arID = this.$route.params.id;
    this.$root.musicStore.picUrl = this.$route.query.item.picUrl;
    this.$root.musicStore.text = this.$route.query.item.name;
    this.$axios.get("/artists?id=" + this.arID).then((data) => {
      this.songs = data.data.hotSongs;
    });
  },
  filters: {
    formatNum(val) {
      if (val < 10) {
        return "0" + val;
      } else {
        return val;
      }
    },
  },
};
</script>

<style lang="less" scoped>
.song {
  p {
    font-size: 14px;
    margin: 5px 0 5px 5px;
    color: rgb(255,208,0);
    background-color: rgb(15,15,15);
  }
}
.listTop {
  width: 100vw;
  height: 200px;
  
  background-color: rgba(0, 0, 0, 0.25);
  justify-content: flex-start;
  align-items: center;
  position: relative;
  .zhezhao {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    -webkit-filter: blur(10px);
    -moz-filter: blur(10px);
    -o-filter: blur(10px);
    -ms-filter: blur(10px);
    filter: blur(10px);
    img{
    width: 100%;
    height: 100%;
    }
  }
  .ltContext {
    padding: 10px 20px;
    display: flex;
    position: absolute;
    left: 0px;
    top: 0px;
    img {
      flex: 1;
      width: 140px;
      height: 125px;
      border-radius: 10px;
    }
    .text {
      color: white;
      text-shadow: 0 0 0.2em black;
      height: 145px;
      padding: 0 50px;
      font-size: 15px;
      display: flex;
      align-items: center;
      justify-content: center;
      h3 {
        font-size: 20px;
        font-weight: bolder;
      }
    }
  }
}
.li {
  display: flex;
  &:first-of-type {
    span {
      color: red;
    }
  }
  &:nth-of-type(2) {
    span {
      color: rgb(218, 29, 29);
    }
  }
  &:nth-of-type(3) {
    span {
      color: rgb(170, 52, 52);
    }
  }
  span {
    display: inline-block;
    line-height: 50px;
    margin: 0 8px;
    color: rgb(100, 100, 100);
  }

  div {
    flex: 1;
  }
}
</style>